#include "IDevice.h"
#include <string>
class StringBuffer : public IBuffer {
public:
    void onLoad(INode *node) {
        if (node)
            this->_copacity = node->get<int>("copacity");
        if (this->_copacity) {
            _content.resize(this->_copacity);
        }
    }
    virtual void *content() {
        return &_content[0];
    }
    virtual int size() {
        return _size;
    }
    virtual int copacity() {
        return _copacity;
    }
    virtual void resize(int size) {
        _size = size;
    }

private:
    int _copacity = 0;
    int _size;
    std::string _content;
};

REG_PLUGIN(StringBuffer);